<?php
class ModelCommunityCommunityHeader extends Model{
    public function addDailyForumPoints($now_time){
        $this->db->query("INSERT INTO " . DB_PREFIX . "community_forum_point_history SET user_id='" . (int)$this->customer->getForumUserId() . "', type='1', description='" . $this->db->escape('Daily Bonus Forum Points') . "', points='" . (int)$this->config->get('daily_bonus') . "', add_time='" . $now_time . "'");

        $this->db->query("UPDATE " . DB_PREFIX . "community_users SET forum_points=forum_points+" . (int)$this->config->get('daily_bonus') . " WHERE user_id='" . (int)$this->customer->getForumUserId() . "'");
    }

    public function getLatestDailyForumPointClaimTime(){
        $query=$this->db->query("SELECT add_time FROM " . DB_PREFIX . "community_forum_point_history WHERE user_id='" . (int)$this->customer->getForumUserId() . "' AND type='1' ORDER BY add_time DESC LIMIT 0,1");

        return $query->row;
    }
}
?>